*************
**// Panel A
*************
** // Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
**//unweighted
ivreg2 PCC, cluster (IDStudy)
**//weighted 
ivreg2 PCC [pweight=investperst], cluster (IDStudy)

**// Repetition
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\598_Rep.dta"
set more off
**//unweighted
ivreg2 PCC, cluster (IDStudy)
**//weighted 
ivreg2 PCC [pweight=investperst], cluster (IDStudy)



*************
**// Panel B
*************
**// Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)

**// Repetition
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\598_Rep.dta"
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)


*************
**// Panel C
*************
**// Reproduction
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\Z&Hcompetition.dta"
set more off
xtset IDStudy
gen double lnobs = ln(Samplesize)
**// weighted
ivreg2 PCC SEPCC dummies Hstatistic developed undeveloped Logit lnobs ///
citations firstpub quadratic Boone IFrecursive regulation OLS ///
reviewed_journal [pweight=investperst], cluster (IDStudy)

lincom  _cons + SEPCC*0 + lnobs*11.3 + IFrecursive*0.744 + ///
citations*4.164078 +firstpub*6.677419 + reviewed_journal*1 + ///
dummies*0 +  Hstatistic*0 + developed*0.3663594 + undeveloped*0.375576 + ///
Logit*0 + regulation*1 + quadratic*0 + Boone*1 + OLS*0

**// unweighted
ivreg2 PCC SEPCC  dummies Hstatistic developed undeveloped FE ///
lnobs ownership Logit SLS firstpub citations profitability ///
IFrecursive, cluster (IDStudy)

lincom _cons+SEPCC*0+dummies*0+Hstatistic*0+developed*0.3663594+ ///
undeveloped*0.375576+SLS*0.1488294+Logit*0+FE*0.229097+lnobs*11.3+ ///
IFrecursive*0.744+citations*4.164078+firstpub*6.453177+ ///
ownership*0.1655518+profitability*0.0434783

**// Repetition
clear
use "C:\Users\Samangi\Documents\Datasets\Chapter Three\598_Rep.dta"
set more off
gen double lnobs = ln(Samplesize)
xtset IDStudy
**// weighted
ivreg2 PCC SEPCC Hstatistic  Logit lnobs citations reviewed_journal firstpub ///
global developed undeveloped dummies RE quadratic DtoD Lerner sampleyear ///
ownership someAveraged [pweight=investperst], cluster (IDStudy)

lincom  _cons + SEPCC*0 + Hstatistic*0 + Logit*0 + lnobs*11.3+ citations*4.164078 + ///
reviewed_journal*1 + firstpub*6.677419 + global*0.7809053 + developed*0.2747882+ ///
dummies*0 + RE*0.0496213 + quadratic*0 + DtoD*0.0472383 + Lerner*0.4137677 + ///
sampleyear*9.739342 + ownership*0.2887069 + someAveraged*0.0562448 + undeveloped*0.2465438 

**//unweighted
ivreg2 PCC SEPCC dummies Hstatistic developed undeveloped SLS Logit FE RE OLS ///
endogeneity macro sampleyear lnobs ownership citations profitability ///
someAveraged, cluster (IDStudy)

lincom _cons+ SEPCC*0+dummies*0+Hstatistic*0+developed*0.2491639+ ///
undeveloped*0.2575251+SLS*0.1220736+Logit*0+FE*0.2508361+RE*0.0719064 + ///
OLS*0 + endogeneity*1 + macro*0.1705686 + sampleyear*9.252508+lnobs*11.3+ ///
ownership*0.1856187+ citations*4.164078+profitability*0.0434783 + ///
someAveraged*0.0267559
